
<%@ page import="fornecedor.FornecedorDominio" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code:'fornecedorDominio.label', default:'FornecedorDominio')}" />
  <title>Edit ${entityName}</title>
  <script>
   function mascara(o,f){
   v_obj=o
   v_fun=f
   setTimeout("execmascara()",1)
}

function execmascara(){
   v_obj.value=v_fun(v_obj.value)
}

function soNumeros(v){
   return v.replace(/\D/g,"")
}

function financeiro(v){
   v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito
   v=v.replace(/(\d{1,3})(\d{2})/,"$1,$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
   //v=v.replace(/(\d{1,3})(\d{2})/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
   return v
}

function metodo(){
 var ehFixo = document.getElementById('tforma_parcelamento_chk');
 if(ehFixo.value != "B"){
     document.getElementById('tdia_vencimento1').value = ""
     document.getElementById('tdia_vencimento1').disabled = true
     document.getElementById('tdia_vencimento2').value = ""
     document.getElementById('tdia_vencimento2').disabled = true
 }
 else{
     document.getElementById('tdia_vencimento1').disabled = false
     document.getElementById('tdia_vencimento2').disabled = false
 }
}

  </script>
</head>
<body>
  <div class="nav">
    <span class="menuButton"><a class="home" href="${resource(dir:'')}">Home</a></span>
    <span class="menuButton"><g:link class="list" action="list">${entityName} List</g:link></span>
    <span class="menuButton"><g:link class="create" action="create">New ${entityName}</g:link></span>
  </div>
  <div class="body">
    <h1>Edit ${entityName}</h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${fornecedorDominioInstance}">
      <div class="errors">
        <g:renderErrors bean="${fornecedorDominioInstance}" as="list" />
      </div>
    </g:hasErrors>
    <g:form method="post" >
<%/*<input type="hidden" name="id" value="<${fornecedorDominioInstance?.tcod_fornecedor_pk}" />*/%>
      <input type="hidden" name="tclassificacao_fiscal_fk" value="${fornecedorDominioInstance?.tclassificacaoFiscalFk}" />
      <input type="hidden" name="tcidade_fk" value="${fornecedorDominioInstance?.tcidadeFk}" />
<%/*<input type="hidden" name="version" value="${fornecedorDominioInstance?.version}" />*/%>
      <div class="dialog">
        <table>
          <tbody>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="trazao_social">
                  <g:message code="fornecedorDominio.trazao_social.label" default="Trazaosocial" />
                </label>

              </td>
              <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'trazao_social','errors')}">
                <input type="text" maxlength="50" id="trazao_social" name="trazao_social" value="${fieldValue(bean:fornecedorDominioInstance,field:'trazaoSocial')}"/>
              </td>
            </tr>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="tnome_fantasia">
                  <g:message code="fornecedorDominio.tnome_fantasia.label" default="Tnomefantasia" />
                </label>

              </td>
              <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tnome_fantasia','errors')}">
                <input type="text" maxlength="50" id="tnome_fantasia" name="tnome_fantasia" value="${fieldValue(bean:fornecedorDominioInstance,field:'tnomeFantasia')}"/>
              </td>
            </tr>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="tnum_cpf_cnpj">
                  <g:message code="fornecedorDominio.tnum_cpf_cnpj.label" default="Tnumcpfcnpj" />
                </label>

              </td>
              <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tnum_cpf_cnpj','errors')}">
                <input type="text" maxlength="30" onkeypress="mascara(this,cnpj)" id="tnum_cpf_cnpj" name="tnum_cpf_cnpj" value="${fieldValue(bean:fornecedorDominioInstance,field:'tnumCpfCnpj')}"/>
              </td>
            </tr>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="tinscricao_estadual">
                  <g:message code="fornecedorDominio.tinscricao_estadual.label" default="Tinscricaoestadual" />
                </label>

              </td>
              <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tinscricao_estadual','errors')}">
                <input type="text" maxlength="30" id="tinscricao_estadual" name="tinscricao_estadual" value="${fieldValue(bean:fornecedorDominioInstance,field:'tinscricaoEstadual')}"/>
              </td>
            </tr>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="tendereco">
                  <g:message code="fornecedorDominio.tendereco.label" default="Tendereco" />
                </label>

              </td>
              <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tendereco','errors')}">
                <input type="text" maxlength="50" id="tendereco" name="tendereco" value="${fieldValue(bean:fornecedorDominioInstance,field:'tendereco')}"/>
              </td>
            </tr>

            <tr class="prop">
              <td valign="top" class="name">
                <label for="tclassificacao_fiscal_fk">
                  <g:message code="fornecedorDominio.tclassificacao_fiscal_fk.label" default="Tclassificacaofiscalfk" />
                </label>

              </td>
              <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tclassificacao_fiscal_fk','errors')}">
                <input disabled="true" type="text" maxlength="3" id="tclassificacao_fiscal_fk" name="tclassificacao_fiscal_fk" value="${fieldValue(bean:fornecedorDominioInstance,field:'tclassificacaoFiscalFk')}"/>
          <g:actionSubmit action="searchClassificacao" value="Buscar" />
          </td>
          </tr>

          <tr class="prop">
            <td valign="top" class="name">
              <label for="ttelefone">
                <g:message code="fornecedorDominio.ttelefone.label" default="Ttelefone" />
              </label>

            </td>
            <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'ttelefone','errors')}">
              <input type="text" maxlength="20" onkeypress="mascara(this,telefone)" id="ttelefone" name="ttelefone" value="${fieldValue(bean:fornecedorDominioInstance,field:'ttelefone')}"/>
            </td>
          </tr>

          <tr class="prop">
            <td valign="top" class="name">
              <label for="tfax">
                <g:message code="fornecedorDominio.tfax.label" default="Tfax" />
              </label>

            </td>
            <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tfax','errors')}">
              <input type="text" maxlength="20" onkeypress="mascara(this,telefone)" id="tfax" name="tfax" value="${fieldValue(bean:fornecedorDominioInstance,field:'tfax')}"/>
            </td>
          </tr>

          <tr class="prop">
            <td valign="top" class="name">
              <label for="tpessoa_responsavel">
                <g:message code="fornecedorDominio.tpessoa_responsavel.label" default="Tpessoaresponsavel" />
              </label>

            </td>
            <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tpessoa_responsavel','errors')}">
              <input type="text" maxlength="50" id="tpessoa_responsavel" name="tpessoa_responsavel" value="${fieldValue(bean:fornecedorDominioInstance,field:'tpessoaResponsavel')}"/>
            </td>
          </tr>

          <tr class="prop">
            <td valign="top" class="name">
              <label for="tramo_atividade_fk">
                <g:message code="fornecedorDominio.tramo_atividade_fk.label" default="Tramoatividadefk" />
              </label>

            </td>
            <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tramo_atividade','errors')}">
              <input type="text" maxlength="50" id="tramo_atividade" name="tramo_atividade" value="${fieldValue(bean:fornecedorDominioInstance,field:'tramoAtividade')}" />
            </td>
          </tr>

          <tr class="prop">
            <td valign="top" class="name">
              <label for="tcidade_fk">
                <g:message code="fornecedorDominio.tcidade_fk.label" default="Tcidadefk" />
              </label>

            </td>
            <td valign="top" class="value ${hasErrors(bean:fornecedorDominioInstance,field:'tcidade_fk','errors')}">
              <input disabled="true" type="text" maxlength="20" id="tcidade_fk" name="tcidade_fk" value="${fieldValue(bean:fornecedorDominioInstance,field:'tcidadeFk')}"/>
          <g:actionSubmit action="searchCidade" value="Buscar" />
          </td>
          </tr>

          </tbody>
        </table>
      </div>
      <div class="buttons">
        <input type="hidden" name="id" value="${fornecedorDominioInstance?.tcodFornecedorPk}" />
        <span class="button"><g:actionSubmit class="save" value="Update" /></span>
        <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Delete" /></span>
      </div>
    </g:form>
  </div>
</body>
</html>
